<template>
  <div>
   
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>分类管理</span>
        </div>
        <h3 style="margin-bottom: 30px;">分类管理:</h3>
        <cardsing></cardsing>
        <el-table
    :data="list"
    style="width: 100%;margin-bottom: 20px;"
    row-key="name"
    border
    default-expand-all
    :tree-props="{children: 'children', hasChildren: 'true'}">
    <el-table-column
      prop="name"
      label="菜单名称"
       fixed
      width="180">
    </el-table-column>
    <el-table-column
      prop="icon"
      label="icon"
      width="180">
      <template  slot-scope="scope">
          <img :src="scope.row.icon" alt="" style="width:60px;height:60px">
      </template>
    </el-table-column>
    <el-table-column
      prop="keywords"
      label="分段名字">
    </el-table-column>
    <el-table-column
      prop="sort"
      label="排序">
    </el-table-column>
    <el-table-column
      prop="showStatus"
      label="显示状态">
      <template  slot-scope="scope">
          <p v-if="scope.row.showStatus==0">不显示</p>
          <p v-else>显示</p>
      </template>
    </el-table-column>
    <el-table-column
      prop="navStatus"
      label="导航栏展示">
      <template  slot-scope="scope">
          <p v-if="scope.row.navStatus==0">不显示</p>
          <p v-else>显示</p>
      </template>
    </el-table-column>
    <el-table-column
      prop="description"
      label="描述">
    </el-table-column>
    <el-table-column
      prop="createTime"
      label="创建时间">
    </el-table-column>
  </el-table>
    </el-card>
  </div>
</template>

<script >
import {getAllCategory} from "@/api/product/index"
import cardsing from "./card"
export default {
  data () {
    return {
        list:[]
    };
  },
    created(){
        var _this=this
        
        getAllCategory().then(res=>{
            console.log(res);
            if(res.success){
              var arr=[]
              res.data.items.forEach((item, index) => {

          var aa = item.category
          aa['children'] = item.children
          arr[index] = aa
        })
        this.list = arr

                // _this.list=res.data.items
            }
        })
    },
  components: {cardsing},

  computed: {},

  mounted() {},

  methods: {}
}

</script>
<style lang="scss" scoped>
.box-card{
    margin: 30px;
}
</style>